<?php
namespace app\common\model;
use think\Model;

class Common extends Model
{
    /**
     * @param string $name 主键名
     * @param int $type 类型 可选已删除
     * @return array $data 返回配置Array数据信息
     */
    public function get_config_value($name)
    {
        $data = [
            'name' => $name,
        ];
        return $this->where($data)->find();
    }

    public function get_config_type($type)
    {
        $data = [
            'type' => $type,
        ];
        return $this->where($data)->select();
    }

    public function save_allowFiled_key($data,$key,$value)
    {
        if(!is_array($data)) {
            exception('非法传参');
        }
        $data = [
            $key => $value
        ];
        return $this->allowField(true)->save($data);
    }
}